package ciyuan.Item.SkillBook;

import ciyuan.Entity.EntityRegisterManager;
import ciyuan.Entity.MagicTexture.MagicTextureEntity;
import ciyuan.Item.ItemGroups;
import ciyuan.Item.TypeInterface.SkillBookType;
import ciyuan.Player.Skill.SkillUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

public class Pity extends SkillBookType {

    public Pity() {
        super(new Properties().tab(ItemGroups.SkillBook));
    }

    @Override
    public void keyDown(PlayerEntity playerEntity) {
        SkillUtils.setSkillColdInterval(playerEntity, this, 28 * 1000);

        MagicTextureEntity magicTextureEntity = new MagicTextureEntity(EntityRegisterManager.magictexture.get(), playerEntity.level);
        magicTextureEntity.moveTo(playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), 0.0F, 0.0F);
        SkillUtils.addEntity(magicTextureEntity, playerEntity.level);
        playerEntity.level.playSound(null, playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), SoundEvents.ANVIL_PLACE, playerEntity.getSoundSource(), 1.0F, 1.0F);

        SkillUtils.saveSkillCastTime(playerEntity,this);
    }

    @Override
    public String getSkillCastName() {
        return "Pity";
    }

    @Override
    public ITextComponent getSkillDescription() {
        return new TranslationTextComponent("ciyuan.skill.desc.13");
    }

    @Override
    public ITextComponent getSkillName() {
        return new TranslationTextComponent("ciyuan.skill.name.13");
    }
}
